home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / RunAsSet.au3 < prev    next >
Text File  |  2007-09-08  |  502b  |  14 lines

  1. ; This example will rerun itself with admin rights on using a local account
  2. ; Note on Vista this may not work as even though the user is admin it may 
  3. ; not be elevated even after the RunAs call.  In that case use #RequireAdmin
  4. ; at the top of the script.
  5.  
  6. ; Are we already admin?
  7. If Not IsAdmin() Then
  8.     RunAsSet('USER', @Computername, 'PASSWORD')
  9.     Run('"' & @AutoItExe & '"' & ' "' & @ScriptFullPath & '"', @WorkingDir)
  10.     Exit
  11. EndIf
  12.  
  13. MsgBox(0, 'Message', 'Now running with admin rights.')
  14.